package com.mc.cloud.mall.common.utils;

import com.mc.cloud.mall.common.common.Constant;
import org.apache.tomcat.util.codec.binary.Base64;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @ClassName Md5Utils
 * @Author MC
 * @Date 2021/5/20 12:52
 * @Version 1.0
 **/
public class MD5Utils {
    
    public static final String getMD5Str(String str) throws NoSuchAlgorithmException {
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        return Base64.encodeBase64String(md5.digest((str+ Constant.SALT).getBytes()));
    }
    
}